package com.huihui.utils;

import android.text.TextUtils;

/**
 * Created by Administrator on 2018/8/11.
 */

public class StringUtils {

    /**
     * 判断是否是一个电话号码
     * @param phone
     * @return
     */
    public static boolean isPhone(String phone) {
        if(TextUtils.isEmpty(phone)) {
            return false;
        }
        boolean matches = phone.matches("^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$");
        return matches;
    }

    public static boolean isGif(String path){
        if (path == null || path.indexOf(".") == -1){
            return false;
            //如果图片地址为null或者地址中没有"."就返回""
        }
        String url = path.substring(path.lastIndexOf(".") + 1).
                trim().toLowerCase();
        if(url.equals("gif")){
            return true;
        }
        return false;
    }
}
